<%-- 
    Document   : go
    Created on : Apr 22, 2012, 8:54:02 PM
    Author     : User
--%>

<%@page import="controller.WK"%>
<%@page import="java.util.ArrayList"%>
<%@page import="preprocessing.SupervisedAttributeSelection"%>
<%@page import="preprocessing.UnsupervisedReplaceMissingValue"%>
<%@page import="preprocessing.UnsupervisedNormalized"%>
<%@page import="preprocessing.UnsupervisedDiscritize"%>
<%@page import="weka.core.Instances"%>
<%@page import="utility.FileReader"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
String a[] = request.getParameterValues("att");
ArrayList<Integer> Attribut = new ArrayList<Integer>();
ArrayList<Integer> AttributFix = new ArrayList<Integer>();
String filter = (String)session.getAttribute("filter");
Instances datax = (Instances)session.getAttribute("dataset");
WK wkwk = new WK();

for(int i = 0; i <= a.length-1; i++) {
    //out.println(a[i]);
    Attribut.add(Integer.parseInt(a[i]));
}

// menginverse
for (int i = 1; i <= 22; i++) {
    if (Attribut.contains(i) == false) {
        AttributFix.add(i);
    }
}

datax = wkwk.returnInsWithAtt(datax, AttributFix);

if(filter.equals("search1")) { // unsupervised discretize
    UnsupervisedDiscritize Discritize = new UnsupervisedDiscritize(datax);
    datax = Discritize.returnInstances(datax);
}
else if(filter.equals("search2")) { // unsupervised normalize
    UnsupervisedNormalized Normalize = new UnsupervisedNormalized(datax);
    datax = Normalize.returnInstances(datax);
}
else if(filter.equals("search3")) { // unsupervised replace missing value
    UnsupervisedReplaceMissingValue Replace = new UnsupervisedReplaceMissingValue(datax);
    datax = Replace.returnInstances(datax);
}
else if(filter.equals("search4")) { // supervised attribute selection
    SupervisedAttributeSelection Normalize = new SupervisedAttributeSelection(datax);
    datax = Normalize.returnInstances(datax);
}
session.setAttribute("dataset", datax);
response.sendRedirect("index.jsp");
%>